import request from "@/utils/request";

//枚举书写请求地址
enum API {
  //获取全部的SKU列表的数据
  skuList = "/admin/product/list/",
  //下架
  cancelSale = `/admin/product/cancelSale/`,
  //上架
  onSale = "/admin/product/onSale/",
  //获取SKU详情的数据
  skuInfo = "/admin/product/getSkuById/",
  //删除某一个SKU
  removeSku = "/admin/product/deleteSku/",
}

//获取已有SKU列表的数据
export const reqSkuList = (page: number, limit: number) =>
  request.get(API.skuList + `${page}/${limit}`);
//下架接口
export const reqCancelSale = (skuId: number) =>
  request.get(API.cancelSale + skuId);
//上架接口
export const reqOnSale = (skuId: number) => request.get(API.onSale + skuId);
//获取SKU详情的数据
export const reqSkuInfo = (skuId: number) => request.get(API.skuInfo + skuId);
//删除SKU的业务
export const reqRemoveSku = (skuId: number) =>
  request.delete(API.removeSku + skuId);
